package com.xinyue.ext.root;

import com.xinyue.ext.BuildParam;
import com.xinyue.ext.data.EntityData;
import com.xinyue.ext.data.RootData;

/**
 * FreeMarker数据装配策略类
 */
public abstract class RootContext implements BuildParam{
	/**
	 * 构建符合FreeMarker标准的数据Root
	 */
	public abstract void freemarkerData(EntityData entity, RootData data);
	
	
	/**
	 * 获得路径
	 * @param pkg
	 * @param name
	 * @return
	 */
	protected String pathBuild(String pkg, String name, int type) {
		String flag = null;
		
		if(bean_ == type) {
			flag = pkg.replace(".", "/") + "/" + name;
		}else if(dao_ == type) {
			flag = pkg.replace(".", "/") + "/" + name + "Dao";
		}else if(daoImpl_ == type) {
			flag = pkg.replace(".", "/") + "/impl/" + name + "DaoImpl";
		}
		return flag;
	}
}
